

'--------------------------------------------------
' Hands-On 30-1
' No code in this Hands-On.
' Please follow the instructions in the book.
'--------------------------------------------------


'--------------------------------------------------
' Hands-On 30-2
' See the code in the State.xml file.
'--------------------------------------------------


'--------------------------------------------------
' Hands-On 30-3
' No code in this Hands-On.
' Please follow the instructions in the book.
'--------------------------------------------------


'--------------------------------------------------
' Hands-On 30-4
' No code in this Hands-On.
' Please follow the instructions in the book.
'--------------------------------------------------


'--------------------------------------------------
' Hands-On 30-5
' See the code in the Customer.xml file.
' See the code in the getInfo.asp file.
'--------------------------------------------------


'--------------------------------------------------
' Hands-On 30-6
' No code in this Hands-On.
' Please follow the instructions in the book.
'--------------------------------------------------


'--------------------------------------------------
' Hands-On 30-7
' Statements to be entered in the Immediate Window.
'--------------------------------------------------

?Range("B5").SmartTags(1).Name
?Range("B5").SmartTags(1).SmartTagActions(1).Name
?Range("B5").SmartTags(1).SmartTagActions(2).Name
?Range("B5").SmartTags(1).SmartTagActions(2).Parent
Range("B5").SmartTags(1).SmartTagActions(2).Execute
?Range("B5").SmartTags(1).XML


'--------------------------------------------------
' Hands-On 30-8 - Code in the SmartTags_VBA.xlsm file
'--------------------------------------------------

Sub AddNExecute_SmartTag()
    Dim strValue
    Dim strLink
    
    strLink = "urn:schemas-internal-office:northwind#Customers"
    
    ' get Customer Id from the user
    strValue = InputBox("Enter an ID of a Northwind customer " _
       & "that is not in the Customer.xml " _
       & "Smart Tag list definition file:", "Enter: Customer ID")
    
    ' exit if user clicked Cancel
    If strValue = "" Then Exit Sub
    
    ' set Smart Tag options to embed and recognize smart tags
    ActiveWorkbook.SmartTagOptions.EmbedSmartTags = True
    Application.SmartTagRecognizers.Recognize = True
    
    With Range("B6")
      .Formula = strValue
      .SmartTags.Add(strLink).SmartTagActions(1).Execute
    End With
End Sub



